package com.zhang.test_zhang.controller;

import com.zhang.test_zhang.entity.User;
import com.zhang.test_zhang.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
@Slf4j
public class UserController {

    @Autowired
    private UserService userService;

    //新增用户
    @PostMapping("/newUser")
    public String newUser(@RequestBody User user) {
        log.info("新增用户：{}", user);
        return userService.newUser(user);
    }

    //查询用户钱包余额
    @GetMapping("/getWallet")
    public User getWallet(int id) {
        log.info("查询用户钱包余额：{}",id);
        return userService.getWallet(id);
    }

}
